<script type="text/javascript">
  $(document).ready(function() {
    $.make_sortable = function(id, url) {
      var obj = $("#" + id);
      obj.sortable({
         axis: 'y',
         dropOnEmpty: false,
         cursor: 'crosshair',
         items: '.sortable',
         opacity: 0.6,
         scroll: true,
         handle: '.drag_handle',
         update: function(event, ui) {
            $.post(url, $("#" + id).sortable('serialize'), function(result) {}, 'script');
         }
      });
    }

    var default_search_tip = "<%= t(:search_issues) %>";
    $("#search").click(function() {
        if ($(this).val() == default_search_tip) {
            $(this).val('').focus();
        }
      }).blur(function() {
        if ($(this).val().length == 0) {
            $(this).val(default_search_tip);
        }
      }).keydown(function(event) {
        if (event.keyCode == 13) {
          location.href = '/search/' + $(this).val();
          return false;
        }
    });

    $(".bg_highlight").live('mouseenter', function() { $(this).css('backgroundColor', '#FFC'); $(this).children('.hide').addClass('show').removeClass('hide');})
      .live('mouseleave', function() { $(this).css('backgroundColor', '#FFF'); $(this).children('.show').addClass('hide').removeClass('show'); });

    $("div[clickable], li[clickable]").mouseover(function() { $(this).css('cursor', 'pointer'); }).click(function() {
      location.href = $(this).attr('clickable');
    });

    $("div.row").live('hover', function(ev) {
      if (ev.type == "mouseenter") {
        $(this).find('a[data-method=delete]').removeClass('hide');
      } else if (ev.type == "mouseleave") {
        $(this).find('a[data-method=delete]').addClass('hide');
      }
    });

    <%= yield :on_ready_hook %>

    $("a.facebox").live('click', function() {
        $(this).facebox()
        });
    $(".tiptip").tipTip({defaultPosition: 'bottom'});


    $(".tablesorter").tablesorter();

    //When page loads...
    $(".tab_content").hide(); //Hide all content
    $("ul.tabs li:first").addClass("active").show(); //Activate first tab
    $(".tab_content:first").show(); //Show first tab content

    //On Click Event
    $("ul.tabs li").click(function() {
      $("ul.tabs li").removeClass("active"); //Remove any "active" class
      $(this).addClass("active"); //Add "active" class to selected tab
      $(".tab_content").hide(); //Hide all tab content

      var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
      $(activeTab).fadeIn(); //Fade in the active ID content
      return false;
    });

    $('.column').equalHeight();
  });
</script>
